#ifndef CLIENT_H
#define CLIENT_H

#include <FifoLectura.h>
#include <FifoEscritura.h>
#include <Logger.h>
#include <Serializable.h>
#include <MessageTxRx.h>

class Client
{
public:
	Client();
	~Client();
	
	void joinChiefClientQueue();
	void createInstructionReceptor();
	void checkInAttQueue();
	std::string retrieveInstructions();
	bool shouldLeave(const std::string& instruction) const;
	bool hasBeenAssisted(const std::string& instruction) const;
	void askForGas(int amount);

private:
	static const int FAIL_EXIT = -1;
	static const int RETREATE_EXIT = 1;
	
	FifoLectura m_ReceptorFifo;
	std::string m_ReceptorFifoPathName;
	bool m_ReceptorFifoAbierto;
	
	FifoEscritura m_ReceptorJefe;
	
	Logger* m_Log;
	
	MessageTxRx m_MessageTxRx;
	
	void abrirReceptorFifo();
};

#endif // CLIENT_H
